#include <iostream>
using namespace std;

int main(){
    int arr[3];
    arr[0] = 10;
    arr[1] = 11;
    arr[2] = 22;
    cout << arr[0] << endl;
    cout << arr[1] << endl;
    cout << arr[2] << endl;
    puts("============================");

    int arr2[3] = {123,456};
    arr2[2] = 789;
    // arr2[3] = 10086;
    cout << arr2[0] << "," << arr2[1] << "," << arr2[2] << "," << arr2[3] <<endl;
    arr2[4] = 664;
    cout << arr2[0] << "," << arr2[1] << "," << arr2[2] << "," << arr2[3] <<  "," << arr2[4] <<endl;
    cout << "arr2's length is : " << sizeof(arr2) / sizeof(int)<< endl;

    puts("+++++++++++++++++++++++++++++++");
    int len = sizeof(arr2) / sizeof(int);
    for(int a = 0 ; a < len ; a++){
        cout << arr2[a]<< " ";
    }
    puts("");
    puts("============================");
    int* av = arr2;
    for(int i = 0 ; i < len ; i++){
        cout << *av++ << " ";
    }
    puts("");
    // 编译时加入 -std=c++11 才能使用高级for循环的语法
    puts("=============g++ .\arr.cpp -o arr -std=c++11===============");
    for(int e : arr2){
        cout << e << " ";
    }
    puts("");
    puts("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
    int ar[3][4] = {
        {1,2,3,4},
        {11,22,33,44},
        {111,222,333,444}
    };
    len = sizeof(ar) / sizeof(ar[0]);
    int len2 = sizeof(ar[0])/sizeof(int);
    for(int i = 0 ; i < len ; i++){
        for(int j = 0 ; j < len2 ; j++){
            cout << ar[i][j] << "\t";
        }
        cout << endl;
    }
    return 0;
}